package com.zhou.cloud.config.kafka;

/**
 * @descrition: Kafka 消息接受端
 * @author: zhouyongjun
 * @date: 2022/7/22
 **/

import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.annotation.StreamListener;
import org.springframework.cloud.stream.messaging.Sink;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.messaging.Message;

@Slf4j
//消息接收端，stream给我们提供了Sink,Sink源码里面是绑定input的，要跟我们配置文件的input关联的。
//@EnableBinding(value = Sink.class)
public class KafkaMessageReceiveListener {

    /**
     * 从缺省通道接收消息
     * @param message
     */
//    @StreamListener(Sink.INPUT)
//    @KafkaListener
    public void receive(Message<String> message){

        log.warn("订阅消息：message={},data = {}",  message.getPayload(),message);
    }
}

